<template>
  <div class="menu-box">
    <ul class="menu-list">
      <li v-for="(item,index) in menuList" :class="{active:index==current}" @click="onJump(item,index)" :key="index">
        <a>
          {{item.name}}
        </a>
      </li>
    </ul>
    <div class="menu-add">

    </div>
  </div>
</template>

<script>
export default {
  name: '',
  props: {
    menuList: {
      type: Array,
      default: []
    },
    current: {
      type: String || Number,
      default: 0
    },
  },
  data() {
    return {



    }
  },
  methods: {
    onJump(item, index) {
      if (item.name == "安全中心" || item.name == "运维管理") {
        this.$YsMessage.error('暂未授权');
      } else {
        this.current = index
        if (item.path) {
          this.$router.push(item.path)
        }
      }

    }
  },
  mounted() {

  },
  watch: {

  },
  computed: {

  },
  filters: {

  }
}
</script>

<style scoped lang='less'>
.menu-box {
  display: flex;
  margin-bottom: -1px;
  .menu-list {
    display: flex;
    overflow: auto;
    width: calc(100% - 47px);
    /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
    &::-webkit-scrollbar {
      width: 2px;
      height: 4px;
    }

    /*定义滚动条轨道 内阴影+圆角*/
    &::-webkit-scrollbar-track {
      background-color: #e0dfdf;
    }

    /*定义滑块 内阴影+圆角*/
    &::-webkit-scrollbar-thumb {
      background-color: #bbb8b8;
    }

    li {
      width: 166px;
      flex-shrink: 0;
      text-align: center;
      background: #ffffff;
      border: 1px solid #cfd7e5;
      border-radius: 4px 4px 0px 0px;
      font-family: PingFang SC;
      font-weight: 400;
      a {
        font-size: 16px;
        color: #405680;
        height: 48px;
        line-height: 48px;
        display: block;
      }
    }
    .active {
      background: #0061ff;
      a {
        color: #ffffff;
      }
    }
  }
  .menu-add {
    width: 47px;
    height: 48px;
    margin-left: auto;
    background: #ffffff url("../../assets/images/add.png") center no-repeat;
    border: 1px solid #cfd7e5;
    opacity: 1;
    border-radius: 4px 4px 0px 0px;
  }
}
</style>